﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace Delay
{
    public class PhoneInfoContentView:DependencyObject, INotifyPropertyChanged
    {
        public PhoneInfoContentView()
        {
            _poneConterItems = new ObservableCollection<PhoneInfoCenterItem>();
           // ImageVis = false;
        }
        private ObservableCollection<PhoneInfoCenterItem> _poneConterItems;
        public ObservableCollection<PhoneInfoCenterItem> PoneConterItems
        {
            get
            {
                return _poneConterItems;
            }
            set
            {
                if (_poneConterItems != value)
                {
                    _poneConterItems = value;
                    NotifyPropertyChanged("PoneConterItems");
                }
            }
        }
        private int _result;
        public int Result
        {
            get
            {
                return _result;
            }
            set
            {
                if (_result != value)
                {
                    _result = value;
                    NotifyPropertyChanged("Result");
                }
            }
        }
        public string Title
        {
            get;
            set;
        }
        public string Writetime
        {
            get;
            set;
        }
        public string Replytime
        {
            get;
            set;
        }  
        public string ResultMsg
        {
            get;
            set;
        }       
       
        public bool AllowAdd
        {
            get;
            set;
        }
        public int CurrentPage
        {
            get;
            set;
        }
        public int TotalPage
        {
            get;
            set;
        }
        public int PageSize
        {
            get;
            set;
        }
        public string ClassNmae
        {
            get;
            set;
        }
        
        public string ReadCount
        {
            get;
            set;
        }
        
        public string ReplyCount
        {
            get;
            set;
        }
        public string GetPhoneInfoUrl(int p, string topicid, int isall, InfoType infoType, int isbible)
        {
            //这个函数不同的类一般要改写
            string url;
            if (infoType == InfoType.Info)
            {
                if (this.ClassNmae == "phoneInfoContent")
                {
                    url = QueryXml.PhoneContentUrl;
                }
                else if (this.ClassNmae == "phoneInfoReply")
                {
                    url = QueryXml.PhoneReplyUrl;
                }
                else
                {
                    url = null;
                    return url;
                }
            }
            else
            {
                if (this.ClassNmae == "phoneInfoContent")
                {
                    url = QueryXml.PhoneEyeContentUrl;
                }
                else if (this.ClassNmae == "phoneInfoReply")
                {
                    url = QueryXml.PhoneEyeReplyUrl;
                }
                else
                {
                    url = null;
                    return url;
                }
            }
            url += ("imei=" + QueryXml.imei);
            url += ("&phonename=" + QueryXml.phonename);
            url += ("&phonevs=" + QueryXml.phonevs);
            url += ("&phonevsno=" + QueryXml.phonevsno);
            url += ("&keyvalue=" + QueryXml.keyvalue);
            url += ("&channelkey=" + QueryXml.channelkey);

            url += ("&topicid=" + topicid.ToString());
            url += ("&isall=" + isall.ToString());
            url += ("&p=" + p.ToString());
            url += ("&total=" + TotalPage.ToString());
            url += ("&pagesize=" + PageSize.ToString());
            url += ("&isbible=" + isbible.ToString());
            //
            return url;
        }
        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
